\input{../../helper/2010.11.24-11.15.25_ES1}
\section{Simulation Results for Single-Queue}

\subsection{Batch means}
In the figure~\ref{dia:r21}, there forty batches, but only thirty-nine batches are available, and the last one which is labeled by red color is discarded. And the mean value is
\begin{equation}
  \bar{\mu} = \sampleMeanValue
\end{equation}

\begin{figure}[htp]
  \includegraphics[width=\textwidth]{dias/r21}
  \begin{tabular}{llll}
    \sampleDelayBatches
  \end{tabular}
  \caption{Single-Queue result($\sampleUnit$)}
  \label{dia:r21}
\end{figure}

\subsection{Confidence interval}
Suppose the sample is \DataSet{}$=<d_i, i \in{} [1,2,3,\cdots{},\sampleDelayBatchSize]>$.

So the mean value of \DataSet{} is
\begin{equation}
\mu = \frac{\displaystyle{\sum_{i=1}^{\sampleDelayBatchSize}d_i}}{\sampleDelayBatchSize} = \sampleMeanValue
\end{equation}
, and the standard deviation of \DataSet{} is
\begin{equation}
  \sigma = \sqrt{\frac{1}{\sampleDelayBatchSize-1}\sum_{i=1}^{\sampleDelayBatchSize}(d_i-\mu)^2} = \sampleStd
\end{equation}

With $\mu$ and $\sigma$, we can calculate the lower limit($l$) and upper limit($u$) of confidence interval of \DataSet:
\begin{align}
  N &= 40 \\
  interval &=n \frac{\sigma}{\sqrt{N}} \\
  lower &= \mu - interval\\
  upper &= \mu + interval\\
  Percentage &= \frac{interval}{\mu}\times{}100\%
\end{align}
and the value of $n$ and results are in the table~\ref{tab:cin}.
\begin{table}[htp]
\center
  \ciTable[($\sampleUnit$)]{\sampleCIs}
  \ciFormatTable[($\sampleUnit$)]{\sampleFormatCIs}
  \caption{The N value and result of confidence interval}
  \label{tab:cin}
\end{table}

\subsection{The theoretic result for delay}
In \emph{M/M/1/K}, the theoretic result is:
\begin{align}
  \rho    &= 0.8 \\
  K       &= 10  \\
  \bar{N} &= \frac{\rho}{1-\rho}-\frac{(K+1)\rho^{K+1}}{1-\rho^{K+1}}\\
  \bar{T} &= \frac{\bar{N}}{\lambda_{eff}}\\
          &= \frac{\bar{N}}{\lambda(\frac{1-\rho^K}{1-\rho^{K+1}})}\\
          &= \trod{}\sampleUnit{}
\end{align}

In 95\%, $\trod{}\sampleUnit{}$ is in the confidence interval. That means the real lives data contains the theoretic result.

\subsection{Loss Rate}
\begin{table}[htp]
\center
  \begin{tabular}{ccccc}
    \sampleLossRates
  \end{tabular}
  \ciTable[$(\times{}100\%)$]{\sampleLossRateCIs}
  \ciFormatTable[$(\times{}100\%)$]{\sampleLossRateFormatCIs}
  \caption{Loss Rate Result(Mean value=$\sampleLossRateMean$)}
  \label{tab:lrr}
\end{table}
The mean and confidence interval result of the loss rate is in table~\ref{tab:lrr}. And the calculation is similar to the delay time.

And the theoretic result of loss rate for the M/M/1/K queue is:
\begin{align}
  \rho    &= 0.8 \\
  K       &= 10  \\
  k       &= K   \\
  p_k     &= \frac{(1-\rho)\rho^k}{1-\rho^{K+1}} \\
          &= \trolr{}
\end{align}

In 95\%, $\trolr{}$ is also in the confidence interval.
\subsection{Time spent}
The details timetable can be found here: \href{http://code.google.com/p/wpcdcuassignment2010-2011/source/list?repo=ee509a1}{Develop Timetable}.

In order to make this assignment more interesting, I use \erlang{} for functional programming and implement the assignment in two models: Time Driven Model and Event Driven Model.

I spent 20 hours for Time Driven Model, 6 hours for Event Driven Model, and 15 hours for the report and discussion with classmates.
